package com.aspose.cells;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

class zcek {
   private zok a;
   private Workbook b;
   private com.aspose.cells.b.a.d.zh c;
   private zcel d;
   private zol e;

   zcek(zcel var1, zok var2) throws Exception {
      this.a = var2;
      this.d = var1;
      this.b = var2.a;
      this.c = new com.aspose.cells.b.a.d.zh();
   }

   void a(zol var1, String var2, com.aspose.cells.a.f.zj var3) throws Exception {
      this.e = var1;
      this.a();
      zcel.a(var2, this.c, var3);
      this.c.a();
      this.c = null;
   }

   private void a() throws Exception {
      Worksheet var1 = this.e.a;
      zcdb var2 = new zcdb(129);
      var2.a(this.c);
      zcen var3 = new zcen();
      var3.a(var1);
      var3.a(this.c);
      this.l();
      this.a(var1, this.b);
      this.j();
      this.k();
      if (this.e.a.a() != null) {
         zcdm var4 = new zcdm(var1.getProtection());
         var4.a(this.c);
      }

      this.b();
      if (var1.hasAutofilter()) {
         a(var1.getAutoFilter(), this.c);
      }

      this.c();
      if (var1.getCells().q() != null && var1.getCells().q().getCount() != 0) {
         this.c(var1);
      }

      if (var1.m != null && var1.getConditionalFormattings().getCount() != 0) {
         this.b(var1);
      }

      if (var1.getValidations().getCount() != 0) {
         this.a(var1);
      }

      if (this.e.f != null && this.e.f.size() > 0) {
         this.i();
      }

      this.a(var1.getPageSetup(), this.e.s, var1.getHorizontalPageBreaks(), var1.getVerticalPageBreaks());
      if (this.e.m.a != null) {
         zcbm var5 = new zcbm(this.e.m.a);
         var5.a(this.c);
      }

      if (this.e.n.a != null) {
         zcck var6 = new zcck(this.e.n.a);
         var6.a(this.c);
      }

      if (this.e.l.a != null) {
         zccj var7 = new zccj(this.e.l.a);
         var7.a(this.c);
      }

      if (this.e.r != null) {
         zbwt var8 = new zbwt(this.e.r);
         var8.a(this.c);
      }

      this.f();
      this.g();
      this.h();
      this.d();
      this.e();
      zcdb var9 = new zcdb(130);
      var9.a(this.c);
   }

   private void b() throws Exception {
      Worksheet var1 = this.e.a;
      ScenarioCollection var2 = var1.o;
      if (var2 != null && var2.getCount() != 0) {
         zde var3 = new zde(var2);
         var3.a(this.c);
         Iterator var4 = var2.iterator();

         while(var4.hasNext()) {
            Scenario var5 = (Scenario)var4.next();
            zdf var6 = new zdf(var5);
            var6.a(this.c);
            Iterator var7 = var5.getInputCells().iterator();

            while(var7.hasNext()) {
               ScenarioInputCell var8 = (ScenarioInputCell)var7.next();
               zdq var9 = new zdq(var8);
               var9.a(this.c);
            }

            zcdb.a(503, this.c);
         }

         zcdb.a(501, this.c);
      }
   }

   private void c() throws Exception {
      Worksheet var1 = this.e.a;
      if (var1.n != null && var1.n.getCount() != 0) {
         zcdb var2 = new zcdb(422);
         var2.a(this.c);
         Iterator var3 = var1.n.iterator();

         while(var3.hasNext()) {
            znb var4 = (znb)var3.next();
            zdg var5 = new zdg(var4);
            var5.a(this.c);
            if (var4.h != null) {
               this.a(var4.h, var4.y());
            }

            if (var4.i != null) {
               this.a(var4.i);
            }

            this.a(var4.j, var4.b, var4.k, var4.l);
            zcdb var6 = new zcdb(424);
            var6.a(this.c);
         }

         zcdb var7 = new zcdb(425);
         var7.a(this.c);
      }
   }

   private void d() throws Exception {
      Worksheet var1 = this.e.a;
      if (var1.getConditionalFormattings().b()) {
         zbzn var2 = new zbzn();
         var2.a(this.c);
         zcdb var3 = new zcdb(1135);
         var3.a(this.c);

         for(int var4 = 0; var4 < var1.getConditionalFormattings().getCount(); ++var4) {
            FormatConditionCollection var5 = var1.getConditionalFormattings().get(var4);
            if (var5.a(true)) {
               zbwz var6 = new zbwz();
               var6.a(var5);
               var6.a(this.c);

               for(int var7 = 0; var7 < var5.getCount(); ++var7) {
                  FormatCondition var8 = var5.get(var7);
                  zbxj var9 = new zbxj();
                  var9.a(var8);
                  var9.a(this.c);
                  switch(var8.getType()) {
                  case 2:
                     this.f(var8);
                     break;
                  case 3:
                     this.d(var8);
                     break;
                  case 4:
                     this.b(var8);
                  }

                  zcdb var10 = new zcdb(1049);
                  var10.a(this.c);
               }

               zcdb var13 = new zcdb(1047);
               var13.a(this.c);
            }
         }

         zcdb var11 = new zcdb(1136);
         var11.a(this.c);
         zcdb var12 = new zcdb(36);
         var12.a(this.c);
      }
   }

   private void e() throws Exception {
      ArrayList var1 = this.e.h;
      if (var1 != null) {
         int var2 = var1.size();
         ArrayList var3 = new ArrayList();
         zqe var4 = null;

         int var5;
         for(var5 = 0; var5 < var2; ++var5) {
            var4 = (zqe)var1.get(var5);
            if (var4.d.equals("http://schemas.microsoft.com/office/2007/relationships/slicer")) {
               com.aspose.cells.b.a.a.ze.a(var3, (Object)var4);
            }
         }

         var5 = var3.size();
         if (var5 > 0) {
            zbzn var6 = new zbzn();
            var6.a(this.c);
            zcdb var7 = new zcdb(1079);
            var7.a(this.c);

            for(int var8 = 0; var8 < var5; ++var8) {
               var4 = (zqe)var3.get(var8);
               zbzg var9 = new zbzg(var4.c);
               var9.a(this.c);
               zcdb var10 = new zcdb(1082);
               var10.a(this.c);
            }

            zcdb var11 = new zcdb(1080);
            var11.a(this.c);
            zcdb var12 = new zcdb(36);
            var12.a(this.c);
         }
      }

   }

   private void f() throws Exception {
      ArrayList var1 = this.e.o;
      int var2 = var1.size();
      if (var2 != 0) {
         zcdb var3 = new zcdb(638);
         var3.a(this.c);

         for(int var4 = 0; var4 < var1.size(); ++var4) {
            zob var5 = (zob)var1.get(var4);
            zcco var6 = new zcco(var5);
            var6.a(this.c);
         }

         zcdb var7 = new zcdb(640);
         var7.a(this.c);
      }
   }

   private void g() throws Exception {
      if (this.e.p.size() != 0) {
         zcdb var1 = new zcdb(643);
         var1.a(this.c);
         ArrayList var2 = this.e.p;

         for(int var3 = 0; var3 < var2.size(); ++var3) {
            zpf var4 = (zpf)var2.get(var3);
            zbwr var5 = new zbwr(var4);
            var5.a(this.c);
         }

         zcdb var6 = new zcdb(645);
         var6.a(this.c);
      }
   }

   private void h() throws Exception {
      int var1 = this.e.v.size();
      if (var1 != 0) {
         zcdb var2 = new zcdb(660, var1);
         var2.a(this.c);
         Iterator var3 = this.e.v.values().iterator();

         while(var3.hasNext()) {
            String var4 = (String)var3.next();
            zcdx var5 = new zcdx(var4);
            var5.a(this.c);
         }

         zcdb var6 = new zcdb(662);
         var6.a(this.c);
      }
   }

   private void a(Worksheet var1, Workbook var2) throws Exception {
      zcem var3 = new zcem(var1, var2);
      var3.a(this.c);
   }

   static void a(AutoFilter var0, com.aspose.cells.b.a.d.zh var1) throws Exception {
      zbwv var2 = new zbwv(var0.h());
      var2.a(var1);

      for(int var3 = 0; var3 < var0.e.getCount(); ++var3) {
         FilterColumn var4 = var0.e.get(var3);
         if (var4.getFilterType() != 6) {
            zbxd var5 = new zbxd(var4);
            var5.a(var1);
            zcdb var23;
            switch(var4.getFilterType()) {
            case 0:
               ColorFilter var18 = (ColorFilter)var4.getFilter();
               zcbb var24 = new zcbb();
               var24.a(var18);
               var24.a(var1);
               break;
            case 1:
               CustomFilterCollection var16 = (CustomFilterCollection)var4.getFilter();
               byte var22 = 0;
               if (var16.getAnd() && var16.getCount() > 1) {
                  var22 = 1;
               }

               var23 = new zcdb(172, var22);
               var23.a(var1);

               for(int var25 = 0; var25 < var16.getCount(); ++var25) {
                  CustomFilter var28 = var16.get(var25);
                  zcbk var11 = new zcbk();
                  var11.a(var28);
                  var11.a(var1);
               }

               zcdb var26 = new zcdb(173);
               var26.a(var1);
               break;
            case 2:
               DynamicFilter var15 = (DynamicFilter)var4.getFilter();
               zcbp var20 = new zcbp();
               var20.a(var15);
               var20.a(var1);
               break;
            case 3:
               MultipleFilterCollection var14 = (MultipleFilterCollection)var4.getFilter();
               zbxe var19 = new zbxe(var14);
               var19.a(var1);

               for(int var8 = 0; var8 < var14.getCount(); ++var8) {
                  Object var9 = var14.get(var8);
                  if (var9 instanceof DateTimeGroupItem) {
                     zcbl var10 = new zcbl();
                     var10.a((DateTimeGroupItem)var9);
                     var10.a(var1);
                  } else {
                     zccc var27 = new zccc((String)var9);
                     var27.a(var1);
                  }
               }

               var23 = new zcdb(166);
               var23.a(var1);
               break;
            case 4:
               IconFilter var13 = (IconFilter)var4.getFilter();
               zcci var17 = new zcci();
               var17.a(var13);
               var17.a(var1);
               break;
            case 5:
               Top10Filter var6 = (Top10Filter)var4.getFilter();
               zced var7 = new zced();
               var7.a(var6);
               var7.a(var1);
            }

            zcdb var21 = new zcdb(164);
            var21.a(var1);
         }
      }

      zcdb var12 = new zcdb(162);
      var12.a(var1);
   }

   private void a(PageSetup var1, String var2, HorizontalPageBreakCollection var3, VerticalPageBreakCollection var4) throws Exception {
      if (var1 != null) {
         zccy var5 = new zccy(var1);
         var5.a(this.c);
         zccl var6 = new zccl(var1);
         var6.a(this.c);
         zccp var7 = new zccp(var1, var2);
         var7.a(this.c);
      }

      int var10;
      zcdb var11;
      zbwu var12;
      if (var3 != null && var3.getCount() > 0) {
         zbxi var8 = new zbxi(var3);
         var8.a(this.c);

         for(var10 = 0; var10 < var3.getCount(); ++var10) {
            var12 = new zbwu();
            var12.a(var3.get(var10));
            var12.a((com.aspose.cells.b.a.d.zm)this.c);
         }

         var11 = new zcdb(393);
         var11.a(this.c);
      }

      if (var4 != null && var4.getCount() > 0) {
         zbww var9 = new zbww(var4);
         var9.a(this.c);

         for(var10 = 0; var10 < var4.getCount(); ++var10) {
            var12 = new zbwu();
            var12.a(var4.get(var10));
            var12.a((com.aspose.cells.b.a.d.zm)this.c);
         }

         var11 = new zcdb(395);
         var11.a(this.c);
      }

      if (var1 != null) {
         this.a(var1);
      }

   }

   private void a(PageSetup var1) throws Exception {
      zccg var2 = new zccg();
      var2.a(var1);
      var2.a(this.c);
      zcdb var3 = new zcdb(480);
      var3.a(this.c);
   }

   private void i() throws Exception {
      for(int var1 = 0; var1 < this.e.f.size(); ++var1) {
         zoa var2 = (zoa)this.e.f.get(var1);
         zccf var3 = new zccf();
         var3.a(var2);
         var3.a(this.c);
      }

   }

   private void a(Worksheet var1) throws Exception {
      if (var1.getValidations().getCount() != 0) {
         zbxb var2 = new zbxb();
         var2.a(var1.getValidations());
         var2.a(this.c);

         for(int var3 = 0; var3 < var1.getValidations().getCount(); ++var3) {
            Validation var4 = var1.getValidations().get(var3);
            zcbn var5 = new zcbn();
            var5.a(var4);
            var5.a(this.c);
         }

         zcdb var6 = new zcdb(574);
         var6.a(this.c);
      }
   }

   private void b(Worksheet var1) throws Exception {
      if (var1.getConditionalFormattings().getCount() != 0) {
         var1.getConditionalFormattings().a();

         for(int var2 = 0; var2 < var1.getConditionalFormattings().getCount(); ++var2) {
            FormatConditionCollection var3 = var1.getConditionalFormattings().get(var2);
            if (var3.b(false) == 0) {
               zbwy var4 = new zbwy();
               var4.a(var3);
               var4.a(this.c);

               for(int var5 = 0; var5 < var3.getCount(); ++var5) {
                  FormatCondition var6 = var3.get(var5);
                  zbxk var7 = new zbxk();
                  var7.a(var6);
                  var7.a(this.c);
                  if (var6.getType() == 4) {
                     this.a(var6);
                  } else if (var6.getType() == 3) {
                     this.c(var6);
                     zbzn var8 = new zbzn();
                     var8.a(this.c);
                     zbzk var9 = new zbzk(var6.b().a());
                     var9.a(this.c);
                     zcdb var10 = new zcdb(36);
                     var10.a(this.c);
                  } else if (var6.getType() == 2) {
                     this.e(var6);
                  }

                  zcdb var12 = new zcdb(464);
                  var12.a(this.c);
               }

               zcdb var11 = new zcdb(462);
               var11.a(this.c);
            }
         }

      }
   }

   private void a(FormatCondition var1) throws Exception {
      IconSet var2 = var1.getIconSet();
      zbxh var3 = new zbxh(false);
      var3.a(var2);
      var3.a(this.c);

      for(int var4 = 0; var4 < var2.getCfvos().getCount(); ++var4) {
         ConditionalFormattingValue var5 = var2.getCfvos().get(var4);
         this.a(var5, false);
      }

      zcdb var6 = new zcdb(466);
      var6.a(this.c);
   }

   private void b(FormatCondition var1) throws Exception {
      IconSet var2 = var1.getIconSet();
      zbxh var3 = new zbxh(true);
      var3.a(var2);
      var3.a(this.c);

      int var4;
      for(var4 = 0; var4 < var2.getCfvos().getCount(); ++var4) {
         ConditionalFormattingValue var5 = var2.getCfvos().get(var4);
         this.a(var5, true);
      }

      if (var2.isCustom()) {
         for(var4 = 0; var4 < var2.getCfIcons().getCount(); ++var4) {
            ConditionalFormattingIcon var8 = var2.getCfIcons().get(var4);
            zbzj var6 = new zbzj(var8);
            var6.a(this.c);
         }
      }

      zcdb var7 = new zcdb(1155);
      var7.a(this.c);
   }

   private void a(ConditionalFormattingValue var1, boolean var2) throws Exception {
      zcax var3 = new zcax(var1, var2);
      var3.a(this.c);
   }

   private void c(FormatCondition var1) throws Exception {
      DataBar var2 = var1.getDataBar();
      zbxc var3 = new zbxc(var2, false);
      var3.a(this.c);
      this.a(var2.a, false);
      this.a(var2.b, false);
      zcbc var4 = new zcbc(var2.b(), this.b, false);
      var4.a(this.c);
      zcdb var5 = new zcdb(468);
      var5.a(this.c);
   }

   private void d(FormatCondition var1) throws Exception {
      DataBar var2 = var1.getDataBar();
      zbxc var3 = new zbxc(var2, true);
      var3.a(this.c);
      this.a(var2.a, true);
      this.a(var2.b, true);
      ArrayList var4 = new ArrayList();
      if (var2.getBarBorder().getType() == 1) {
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var2.getBarBorder().a());
      }

      if (var2.getNegativeBarFormat().getColorType() == 0) {
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var2.getNegativeBarFormat().b());
      }

      if (var2.getNegativeBarFormat().getBorderColorType() == 0) {
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var2.getNegativeBarFormat().a());
      }

      if (var2.getAxisPosition() != 2) {
         com.aspose.cells.b.a.a.ze.a(var4, (Object)var2.a());
      }

      Iterator var5 = var4.iterator();

      while(var5.hasNext()) {
         zakp var6 = (zakp)var5.next();
         zcbc var7 = new zcbc(var6, this.b, true);
         var7.a(this.c);
      }

      zcdb var8 = new zcdb(1156);
      var8.a(this.c);
   }

   private void e(FormatCondition var1) throws Exception {
      ColorScale var2 = var1.getColorScale();
      zcdb var3 = new zcdb(469);
      var3.a(this.c);
      this.a(var2.a, false);
      if (var2.b != null) {
         this.a(var2.b, false);
      }

      this.a(var2.c, false);
      zcbc var4 = new zcbc(var2.b(), this.b, false);
      var4.a(this.c);
      if (var2.b != null) {
         var4 = new zcbc(var2.c(), this.b, false);
         var4.a(this.c);
      }

      var4 = new zcbc(var2.d(), this.b, false);
      var4.a(this.c);
      zcdb var5 = new zcdb(470);
      var5.a(this.c);
   }

   private void f(FormatCondition var1) throws Exception {
      zcdb var2 = new zcdb(1157);
      var2.a(this.c);
      ColorScale var3 = var1.getColorScale();
      this.a(var3.a, true);
      if (var3.b != null) {
         this.a(var3.b, true);
      }

      this.a(var3.c, true);
      zcbc var4 = new zcbc(var3.b(), this.b, true);
      var4.a(this.c);
      if (var3.b != null) {
         var4 = new zcbc(var3.c(), this.b, true);
         var4.a(this.c);
      }

      var4 = new zcbc(var3.d(), this.b, true);
      var4.a(this.c);
      zcdb var5 = new zcdb(1158);
      var5.a(this.c);
   }

   private void c(Worksheet var1) throws Exception {
      zani var2 = var1.getCells().q();
      zcdb var3 = new zcdb(177, var2.getCount());
      var3.a(this.c);

      for(int var4 = 0; var4 < var2.getCount(); ++var4) {
         CellArea var5 = var2.a(var4);
         zccm var6 = new zccm(var5);
         var6.a(this.c);
      }

      zcdb var7 = new zcdb(178);
      var7.a(this.c);
   }

   private void j() throws Exception {
      ColumnCollection var1 = this.e.a.getCells().getColumns();
      if (var1.getCount() != 0 || var1.b != null && var1.b.j()) {
         zcdb var2 = new zcdb(390);
         var2.a(this.c);
         int var3 = 16383;
         Column var4 = var1.b;
         if (var4 != null) {
            if (var4.j()) {
               Column var5 = new Column(var4.getIndex(), this.e.a, var1.b(), var4);
               var4 = var5;
               var3 = var5.getIndex();
            } else {
               var4 = null;
            }
         }

         int var11 = 0;

         for(int var6 = 0; var6 < var1.getCount(); ++var6) {
            Column var7 = var1.getColumnByIndex(var6);
            if (var7.getIndex() - var11 != 0 && var4 != null && var7.getIndex() > var3) {
               if (var11 < var3) {
                  var11 = var3;
               }

               var4.a(var11);
               zcba var8 = new zcba();
               var8.a(var4, var7.getIndex() - 1, this.b.getWorksheets().H(), this.a.d.f);
               var8.a(this.c);
            }

            int var14 = var7.c();
            int var9 = 0;
            ++var6;

            while(var6 < var1.getCount()) {
               Column var10 = var1.getColumnByIndex(var6);
               if (var10.getIndex() != var7.getIndex() + var9 + 1 || !var7.b(var10)) {
                  --var6;
                  break;
               }

               ++var9;
               ++var6;
            }

            zcba var15 = new zcba();
            var15.a(var7, var7.getIndex() + var9, this.b.getWorksheets().H(), this.a.d.f);
            var15.a(this.c);
            var11 = var7.getIndex() + var9 + 1;
         }

         if (var4 != null && var11 <= 16383) {
            if (var11 < var3) {
               var11 = var3;
            }

            var4.a(var11);
            zcba var12 = new zcba();
            var12.a(var4, 16383, this.b.getWorksheets().H(), this.a.d.f);
            var12.a(this.c);
         }

         zcdb var13 = new zcdb(391);
         var13.a(this.c);
      }
   }

   private void k() throws Exception {
      zcdb var1 = new zcdb(145);
      var1.a(this.c);
      Cells var2 = this.e.a.getCells();
      zr var3 = var2.f();
      if (var3.a() > 0) {
         RowCollection var4 = var2.getRows();
         zahl var6 = var3.a(-1, -1, false);

         while(true) {
            int var7 = var6.a();
            if (var7 < 0) {
               break;
            }

            Row var5 = var4.b(var7, false);
            if (var5.a.a() == 0) {
               this.a(var5.a);
            } else {
               this.a(var2, var5);
            }
         }
      }

      zcdb var8 = new zcdb(146);
      var8.a(this.c);
   }

   private void a(zp var1) throws Exception {
      zcdg var2 = new zcdg();
      var2.a(var1, 0, 0, this.a.d.f);
      var2.a(this.c);
   }

   private void a(Cells var1, Row var2) throws Exception {
      zp var3 = var2.a;
      zcdg var4 = new zcdg();
      HashMap var5 = this.a.d.f;
      int var6 = var3.a(var3.c(0));
      int var7 = var3.a(var3.c(var3.a() - 1));
      var4.a(var3, var6, var7, var5);
      var4.a(this.c);
      RowCollection var8 = var1.getRows();
      Cell var9 = null;
      boolean var10 = false;
      zahl var11 = var3.a(-1, -1, false);

      while(true) {
         int var12 = var11.a();
         if (var12 < 0) {
            return;
         }

         Cell var13 = new Cell(var2, var12);
         var10 = var9 == null || var9.getColumn() + 1 != var13.getColumn();
         switch(var13.c.c) {
         case 0:
            zcar var15 = new zcar();
            var15.a(var10, var13, var5);
            var15.a(this.c);
            break;
         case 1:
         case 6:
            zcav var18 = new zcav();
            var18.a(var10, var13, var5);
            var18.a(this.c);
            break;
         case 2:
            zcas var14 = new zcas();
            var14.a(var10, var13, var5);
            var14.a(this.c);
            break;
         case 3:
            zcat var19 = new zcat();
            var19.a(var13, var5);
            var19.a(this.c);
            break;
         case 4:
            zcaw var16 = new zcaw();
            var16.a(var10, var13, var5);
            var16.a(this.c);
            break;
         case 5:
            zcau var17 = new zcau();
            var17.a(var13, var5);
            var17.a(this.c);
         }

         var9 = var13;
         boolean var20 = var13.f();
         if (var20) {
            if (var13.isArrayHeader()) {
               zbws var21 = new zbws(var13.D());
               var21.a(this.c);
            } else if (var13.x()) {
               zcdn var22 = new zcdn(var13.D());
               var22.a(this.c);
            }
         }
      }
   }

   private void l() throws Exception {
      zcdb var1 = new zcdb(133);
      var1.a(this.c);
      zbxy var2 = new zbxy();
      var2.a(this.e.a);
      var2.a(this.c);
      this.a(this.e.a.getPanes(), this.e.a.h());
      this.a(this.e.a.s());
      zcdb var3 = new zcdb(138);
      var3.a(this.c);
      zcdb var4 = new zcdb(134);
      var4.a(this.c);
   }

   private void a(PaneCollection var1, boolean var2) throws Exception {
      if (var1 != null) {
         zccq var3 = new zccq();
         var3.a(var1, var2);
         var3.a(this.c);
      }
   }

   private void a(zbcj var1) throws Exception {
      if (var1 != null) {
         for(int var2 = 0; var2 < var1.size(); ++var2) {
            zbci var3 = (zbci)var1.get(var2);
            zcdk var4 = new zcdk();
            var4.a(var3);
            var4.a(this.c);
         }

      }
   }
}
